<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>考试分析</title>
	<meta name="description" content="这是一个 index 页面">
	<meta name="keywords" content="index">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="renderer" content="webkit">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="icon" type="image/png" href="../assets/i/favicon.png">
	<link rel="apple-touch-icon-precomposed" href="../assets/i/app-icon72x72@2x.png">
	<meta name="apple-mobile-web-app-title" content="Amaze UI" />
	<link rel="stylesheet" href="../assets/css/amazeui.min.css" />
	<link rel="stylesheet" href="../assets/css/amazeui.datatables.min.css" />
	<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="../assets/css/app.css">
	<link rel="stylesheet" href="../assets/css/gb_my.css">
	<link rel="stylesheet" href="../assets/css/font-awesome.css">
	<link rel="stylesheet" href="../assets/css/bootstrap-reset.css">
</head>

<body data-type="chart">
	<div class="am-g tpl-g">
		<!--头部-->
		<nav class="navbar navbar-default top-navbar">
			<div class="navbar-header">
				<a class="navbar-brand waves-effect waves-dark" href="javascript:;">
					<img src="../assets/img/logo.png" alt="">
					<strong>轻课网考试系统</strong>
				</a>
				<div id="sideNav" href="">
					<i class="mulv QK QK-mulu"></i>
				</div>
			</div>

			<ul class="nav navbar-top-links navbar-right aaa">
				<li>
					<a id="down_" class="sign-out dropdown-button waves-effect waves-dark" href="javascript:;">
						<span class="am-icon-sign-out"></span> 退出
					</a>
				</li>
				<li>
					<a class="dropdown-button waves-effect waves-dark" href="javascript:;"><b>欢迎你, <span class="userName"></span> </b></a>
				</li>
			</ul>
		</nav>
		<!--导航栏-->
		<nav class="navbar-default navbar-side">
			<div class="sidebar-collapse">
				<!-- 用户头像 -->
				<div class="tpl-sidebar-user-panel">
					<div class="tpl-user-panel-slide-toggleable">
						<div class="tpl-user-panel-profile-picture">
							<img src="../assets/img/user04.png" alt="">
						</div>
					</div>
				</div>
				<dl class="list_dl">
					<dt class="list_dt">
					<a href="../index.html">
						<span class="QK1 start_before"></span>
						<p>首页</p>
					</a>
				</dt>
					<dt class="list_dt">
					<span class="QK1 topic_before"></span>
					<p>题库管理</p>
					<i class="QK1 list_dt_icon"></i>
				</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../questiondb/questiondb.html">管理题库</a>
							</li>
							<li class="list_li">
								<a href="../question/question.html">管理试题</a>
							</li>
						</ul>
					</dd>
					<dt id="open" class="list_dt">
					<span class="QK1 paper_before"></span>
					<p>试卷管理</p>
					<i class="QK1 list_dt_icon"></i>
				</dt>
					<dd class="list_dd" style="display: block">
						<ul>
							<li class="list_li">
								<a href="../paper/addpaper.html">创建试卷</a>
							</li>
							<li class="list_li" id="style_li_a">
								<a href="../paper/paper.html">管理试卷</a>
							</li>
						</ul>
					</dd>
					<dt class="list_dt">
					<span class="QK1 system_before"></span>
					<p>系统管理</p>
					<i class="QK1 list_dt_icon"></i>
				</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../system.html">系统管理</a>
							</li>
							<li class="list_li">
								<a href="../admin/admin.html">管理员</a>
							</li>
							<li class="list_li">
								<a href="../adminroles/adminroles.html">角色管理</a>
							</li>
						</ul>
					</dd>
					<dt class="list_dt">
					<span class="QK1 user_before"></span>
					<p>用户管理</p>
					<i class="QK1 list_dt_icon"></i>
				</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../user/user.html">管理用户</a>
							</li>
							<li class="list_li">
								<a href="../user/usergroup.html">用户分组</a>
							</li>
						</ul>
					</dd>
					<dt class="list_dt">
						<span class="QK1 user_before"></span>
						<p>知识点模块</p>
						<i class="QK1 list_dt_icon"></i>
					</dt>
					<dd class="list_dd">
						<ul>
							<li class="list_li">
								<a href="../KnowledgePoint/KnowledgeBlock.html">管理知识点</a>
							</li>
						</ul>
					</dd>
				</dl>
			</div>
		</nav>
		<!-- 内容区域 -->
		<div id="page-wrapper">
			<div class="row">
				<div class="col-lg-12">
					<section class="panel">
						<header class="panel-heading">
							<span class="label label-primary">考试分析</span>
							<button type="button" class="btn btn-success btn-sm add_clazz btn_my" id="back">
								<span class="QK1 QK-fanhui1"></span>&nbsp;&nbsp;返回
							</button>
						</header>
						<div class="panel-body">
							<div id="unseen" class="unseen">
								<div class="paper_all"></div>
								<div class="user_all"></div>
								<div id="test_questions">
									<div class="test_questions_select">
										<div class="questions_item_radio">
											<h1>单选题</h1>
										</div>
										<div class="questions_item_check">
											<h1>多选题</h1>
										</div>
									</div>
								</div>
							</div>
						</div>
					</section>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/js/theme.js"></script>
<script src="../assets/js/html5sv.js"></script>
<script type="text/javascript" src="../assets/js/jquery.cookie.js"></script>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/data.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/drilldown.js"></script>
<script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
<script src="../assets/js/amazeui.min.js"></script>
<script src="../assets/js/amazeui.datatables.min.js"></script>
<script src="../assets/js/dataTables.responsive.min.js"></script>
<script src="../assets/js/app.js"></script>
<script>
	//试卷id
	var sectionid = window.location.search.split("=")[1];
	var userid = sectionid.split("&")[0];
	var paperid = window.location.search.split("=")[2];

	$("#back").click(function() {
		window.location.href = "examInfo.html?id=" + paperid;
	});
	var differ;
	function data_cal(startime, endtime) {
		var date1 = new Date(startime); //开始时间
		var date2 = new Date(endtime); //结束时间
		var date3 = date2.getTime() - date1.getTime(); //时间差的毫秒数
		//计算出相差天数
		//        var days=Math.floor(date3/(24*3600*1000));
		//计算出小时数
		//        var leave1=date3%(24*3600*1000);    //计算天数后剩余的毫秒数
		var hours = Math.floor(date3 / (3600 * 1000));
		//计算相差分钟数
		var leave2 = date3 % (3600 * 1000); //计算小时数后剩余的毫秒数
		var minutes = Math.floor(leave2 / (60 * 1000));
		//计算相差秒数
		//        var leave3=leave2%(60*1000);      //计算分钟数后剩余的毫秒数
		//        var seconds=Math.round(leave3/1000);
		//        console.log(hours+"小时"+minutes+"分钟");
		differ = hours + '小时' + minutes + '分钟';
	}
	//请求数据
	//                var coulmn = '<tr class="even gradeX student add_p3"><td>' + item.questionWithBLOBs.content + '</td><td>' + item.questionWithBLOBs.skey + '</td><td>' + item.userAnswer + '</td><td>' + item.score+'</td></tr>';
	//                $.each(item.questionWithBLOBs.questionOptions.reverse(), function(n, qop) {
	//                    coulmn2 += '<tr><td>'+qop.salisa+":"+qop.soption+'</td></tr>';
	//                });
	//请求试题卷信息
	var paper_name,
		sorce,
		start_time,
		end_time;
	$.ajax({
		url: localApi + "/Paper/index",
		type: 'get',
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: {
			apikey: '1',
			limit: '999',
			offset: '0'

		},
		success: function(result) {
			//            console.log(result.data);
			$.each(result.data, function(n, item) {
				if(item.id == paperid) {
					paper_name = item.paperName;
					sorce = item.sumscore;
					start_time = item.starttime;
					end_time = item.endtime;
					data_cal(start_time, end_time);
				}
			});
			var paper_all = '<h1>' + paper_name + '</h1>\n' +
				'<h2>试卷信息</h2>\n' +
				'<div class="paper_infromation">\n' +
				'<p>\n' +
				'<span><strong>卷面总分:</strong><span>' + sorce + '分</span></span>\n' +
				'</p>\n' +
				'<p>\n' +
				'<span><strong>时间设定:</strong><span>' + start_time + '至' + end_time + '</span></span>\n' +
				'<span><strong>考试时长:</strong><span>' + differ + '</span></span>\n' +
				'</p>\n' +
				'</div>';
			$(".paper_all").append(paper_all);

		}
	});
	//请求考生信息
	var user_name,
		begin_time,
		last_time,
		consuming,
		mark;
	$.ajax({
		type: "get",
		url: localApi + "/ExamInfo/index",
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: {
			apikey: '1',
			pid: paperid
		},
		success: function(result) {
			//            console.log(result.data);
			$.each(result.data, function(n, item) {
				var time = parseInt((item.edate - item.sdate) / 60000);
				if(item.user.id == userid) {
					user_name = item.user.realname;
					begin_time = formatDate(item.sdate);
					last_time = formatDate(item.edate);
					consuming = time;
					mark = item.score;
				}
			});
			var user_all = '<h2>考生信息</h2>\n' +
				'<div class="paper_infromation">\n' +
				'<p>\n' +
				'<span><strong>考生:</strong><span>' + user_name + '</span></span>\n' +
				'</p>\n' +
				'<p>\n' +
				'<span><strong>开考时间:</strong><span>' + begin_time + '</span></span>\n' +
				'<span><strong>交卷时间:</strong><span>' + last_time + '</span></span>\n' +
				'<span><strong>耗时:</strong><span>' + consuming + '分钟</span></span></p>\n' +
				'<p><span><strong>得分:</strong><span>' + mark + '分</span></span>\n' +
				'</p>\n' +
				'</div>';
			$('.user_all').append(user_all);
		}
	});

	function formatDate(nows) {
		var now = new Date(nows);
		var year = now.getFullYear();
		var month = now.getMonth() + 1;
		var date = now.getDate();
		var hour = now.getHours();
		var minute = now.getMinutes();
		var second = now.getSeconds();
		return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
	}
	//请求试题内容
	$.ajax({
		type: "get",
		async: false,
		url: localApi + "/ExamDetail/index",
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: {
			apikey: '1',
			pid: paperid,
			uid: userid
		},
		success: function(result) {
			console.log(result.data);
			var a = 1;
			var b;
			$.each(result.data, function(n, item) {
				if(item.questionWithBLOBs.skey !== item.userAnswer) {
					b = 'QK2 QK-cuohao03';
				} else {
					b = 'QK2 QK-duihao';
                }
				var content_s = item.questionWithBLOBs.content;
				var content_ss = content_s.replace(/<[^>]+>/g, ""); //去除html标签
				var content_sss = content_ss.replace('&nbsp;', "");
                $('.QK-cuohao03').parent('.content_questions_title').siblings('.your_answer').addClass('your_answer_error');
                if(item.qtype == 1) {
					var paper_questions2 = '<div class="content_questions">\n' +
						'<p class="content_questions_title">\n' +
						'<span>' + a + '.</span>\n' +
						'<span>' + content_sss + '</span>\n' +
						'<span class="' + b + '"></span>\n' +
						'</p>\n' +
						'<ul id="ul' + a + '">\n' +
						'</ul>\n' +
						'<p class="true_answer"><strong>正确答案:</strong><span>' + item.questionWithBLOBs.skey + '</span></p>\n' +
						'<p class="your_answer"><strong>考生答案:</strong><span>' + item.userAnswer + '</span></p>\n' +
						'<p><strong>解析:</strong><span>' + item.questionWithBLOBs.keydesc + '</span></p>\n' +
						'</div>';
                    $('.questions_item_radio').append(paper_questions2);
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'A') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'B') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}

					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'C') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'D') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					a += 1;
				}
			});
			$.each(result.data, function(n, item) {
				if(item.questionWithBLOBs.skey !== item.userAnswer) {
					b = 'QK2 QK-cuohao03';
                } else {
					b = 'QK2 QK-duihao';
				}
				var content_s = item.questionWithBLOBs.content;
				var content_ss = content_s.replace(/<[^>]+>/g, ""); //去除html标签
                $('.QK-cuohao03').parent('.content_questions_title').siblings('.your_answer').addClass('your_answer_error');
                if(item.qtype == 2) {
					var paper_questions4 = '<div class="content_questions">\n' +
						'<p class="content_questions_title">\n' +
						'<span>' + a + '.</span>\n' +
						'<span>' + content_ss + '</span>\n' +
						'<span class="' + b + '"></span>\n' +
						'</p>\n' +
						'<ul id="ul' + a + '">\n' +
						'</ul>\n' +
						'<p class="true_answer"><strong>正确答案:</strong><span>' + item.questionWithBLOBs.skey + '</span></p>\n' +
						'<p class="your_answer"><strong>考生答案:</strong><span>' + item.userAnswer + '</span></p>\n' +
						'<p><strong>解析:</strong><span>' + item.questionWithBLOBs.keydesc + '</span></p>\n' +
						'</div>';
					$('.questions_item_check').append(paper_questions4);
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'A') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'B') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'C') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'D') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'E') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'F') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					$.each(item.questionWithBLOBs.questionOptions.reverse(), function(o, qop1) {
						if(qop1.salisa == 'G') {
							var coulmn4 = '<p>' + qop1.salisa + ".&nbsp;" + qop1.soption + '</p>';
							//                        console.log(coulmn4);
							$("#ul" + a).append(coulmn4);
						}
					});
					a += 1;
				}

			});
		}
	});
</script>
<script>
	$(document).ready(function() {
		$(".list_dt").on("click", function() {
			$('.list_dd').stop();
			$(this).siblings("dt").removeAttr("id");
			if($(this).attr("id") == "open") {
				$(this).removeAttr("id").siblings("dd").slideUp();
			} else {
				$(this).attr("id", "open").next().slideDown().siblings("dd").slideUp();
			}
		});
	});
</script>
<script>
	$(document).ready(function() {
		$(".dropdown-button").dropdown();
		$("#sideNav").click(function() {
			if($(this).hasClass('closed')) {
				$('.navbar-side').animate({
					left: '0px'
				});
				$(this).removeClass('closed');
				$('#page-wrapper').animate({
					'margin-left': '260px'
				});
			} else {
				$(this).addClass('closed');
				$('.navbar-side').animate({
					left: '-260px'
				});
				$('#page-wrapper').animate({
					'margin-left': '0px'
				});
			}
		});
	});
	$(".dropdown-button").dropdown();
</script>